<?php
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if(isset($_RQ['cid'])){
		$goodids=pdo_getall('jy_jdpm_goods',array('cid'=>$_RQ['cid'],'uniacid'=>$_SESSION['uniacid']),array('id'),'id');
		if($goodids){
			$goodids=array_keys($goodids);
		}
		$return['params']['pid']=$_RQ['pid'];
		$return['params']['cid']=$_RQ['cid'];
		$params['goodsid']=$goodids?$goodids:0;
	}else{
		if(isset($_RQ['pid'])){
			$return['params']['id']=$_RQ['pid'];
			$pid = pdo_getcolumn('jy_jdpm_goods_group',array('name' => $_RQ['pid'],'uniacid'=>$_SESSION['uniacid']),'id');
			$cid = pdo_getall('jy_jdpm_goods_group',array('pid'=>$pid,'uniacid'=>$_SESSION['uniacid']),array('id'),'id');
			$cid=array_keys($cid);
			$cid[]=$pid;
			$goodids=pdo_getall('jy_jdpm_goods',array('cid'=>$cid,'uniacid'=>$_SESSION['uniacid']),array('id'),'id');
			if($goodids){
				$goodids=array_keys($goodids);
			}
			$params['goodsid']=$goodids?$goodids:0;
		}
	}
	if(isset($_RQ['pid2'])){
		$params['pid']=intval($_RQ['pid2']);
		$return['params']['pid2']=$_RQ['pid2'];
	}
	if(!empty($_RQ['pname'])){
		$params['pname like']='%'.$_RQ['pname'].'%';
		$return['params']['pname']=$_RQ['pname'];
	}
	if(isset($_RQ['endstatus']) && $_RQ['endstatus'] <10){
		$params['endstatus']=$_RQ['endstatus'];
		$return['params']['endstatus']=$_RQ['endstatus'];
	}
	if($_RQ['endstatus'] ==10){
		$params['starttime >']=time();
		$return['params']['endstatus']=$_RQ['endstatus'];
	}
	if($_RQ['endstatus'] ==11){
		$params['endstatus']=0;
		$params['starttime <']=time();
		$return['params']['endstatus']=$_RQ['endstatus'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 20;
	$total='';
	$list=pdo_getslice('jy_jdpm_auction',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['pname'] = cfc('tools')->substr($item['pname'],0,18);
			if($item['starttime'] > time() && $item['endstatus'] ==0){
				$item['endstatus']=10;
			}
			$item['createtime']=date('Y/m/d H:i:s',$item['createtime']);
			$item['starttime']=date('Y/m/d H:i:s',$item['starttime']);
			$item['endtime']=date('Y/m/d H:i:s',$item['endtime']);
			$good=get_goodsinfo($item['goodsid']);
			$item['image']=$good['image'];
			$member=pdo_get('core_members',array('id'=>$good['merchid']),array('avatar','username','nickname'));
			$item['account']=$member['username'];
			$item['avatar'] = $member['avatar']?$member['avatar']:'../addons/jy_jdpm/resource/images/userlogo.jpg';
			$item['nickname']=$member['nickname'];
			$group=	pdo_get('jy_jdpm_goods_group',array('id'=>$good['cid']),array('pid','title'));
			$p=pdo_getcolumn('jy_jdpm_goods_group',array('id'=>$group['pid']),'title');
			$item['group']=$p.'/'.$group['title'];
			$item['id']=$item['id'].'/'.$item['goodsid'];
			$item['recommend']=$item['recommend']?$item['recommend']:0;
			$item['url']=custom_url(array('plugin'=>'jy_jdpm','action'=>'detail','query'=>'pid='.$item['pid']));
		}
	}
	
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'拍卖管理'),
		),
		'list'=>array('data'=>'list','tip'=>'[<red>温馨提示</red>]：商品不可见？拍品状态异常? 需添加任务，才能正常工作：教程：系统管理-计划任务-创建任务（任务类型：循环；任务URL：jy_jdpm/plan/）','edit'=>false,'del_one'=>true,'delall'=>false,'list'=>array(
			array('name'=>'id','title'=>'PID/GID','type'=>'string'),
			array('type'=>'img_string','title'=>'拍品','img'=>'image',
			'data'=>array(
				array('title'=>'','name'=>'pname','url'=>'url'),
				)
			),
			array('type'=>'img_string','title'=>'卖家','img'=>'avatar',
			'data'=>array(
				array('title'=>'账号：','name'=>'account'),
				array('title'=>'昵称：','name'=>'nickname')
				)
			),
			array('name'=>'group','title'=>'频道/分类','type'=>'string'),
			array('name'=>'succtype','title'=>'模式','type'=>'radio','options'=>'succtype'),
			array('name'=>'starttime','title'=>'开始时间','type'=>'string'),
			array('name'=>'endtime','title'=>'结束时间','type'=>'string'),
			array('name'=>'endstatus','title'=>'状态','type'=>'radio','options'=>'endstatus'),	
		),
		'action'=>array(
			array('op'=>'repm','title'=>'再次拍卖','show'=>array('endstatus'=>array(2,3,4)),'type'=>'href'),
			array('op'=>'edit','title'=>'编辑','show'=>array('endstatus'=>array(2,3,4)),'type'=>'href'),
			array('op'=>'status4','show'=>array('endstatus'=>array(0,10)),'title'=>'撤拍','type'=>'post','message'=>'撤拍将立即结束拍卖，解冻您和买家的保证金。'),
			array('op'=>'recommend','show'=>array('endstatus'=>array(0,10),'recommend'=>0),'title'=>'推荐','type'=>'post'),
			array('op'=>'unrecommend','show'=>array('endstatus'=>array(0,10),'recommend'=>1),'title'=>'取消推荐','type'=>'post'),
			array('op'=>'hide','show'=>array('hide'=>0),'title'=>'隐藏','type'=>'post','message'=>'是否将拍卖隐藏?隐藏后前台页面将不显示该拍卖！'),
			array('op'=>'unhide','show'=>array('hide'=>1),'title'=>'显示','type'=>'post','message'=>'是否将拍卖在前台页面显示?'),
			array('op'=>'unhot','show'=>array('ishot'=>1),'title'=>'取消热门','type'=>'post','message'=>'是否取消拍卖在前台热门模块显示！'),
			array('op'=>'ishot','show'=>array('ishot'=>0),'title'=>'设置热门','type'=>'post','message'=>'是否设置拍卖在前台热门模块显示！'),
			array('op'=>'detail','title'=>'详情','type'=>'href'),
				
			),
		),
		'search'=>array(
			array('type'=>'string','width'=>'15','title'=>'拍卖ID','name'=>'id','help'=>''),
			array('type'=>'string','width'=>'15','title'=>'标题','name'=>'pname','help'=>''),
			array('type'=>'select','width'=>'15','title'=>'状态','name'=>'endstatus','help'=>'','options'=>'endstatus2','select_title'=>'请选择状态'),
			//array('type'=>'group_select','width'=>'15','title'=>'分类','cid'=>'cid','pid'=>'pid','help'=>'','options'=>'cid','option_value'=>'cid','option_title'=>'pname','pid_title'=>'请选择频道','cid_title'=>'请选择子类'),
		),
	);
	$return['pid']=pdo_getall('jy_jdpm_goods_group',array('pid'=>0,'uniacid'=>$_SESSION['uniacid']));
	$c=array();
	foreach($return['pid'] as $v){
		$n=$v['name'];
		$son=pdo_getall('jy_jdpm_goods_group',array('pid'=>$v['id'],'uniacid'=>$_SESSION['uniacid']));
		foreach($son as $s){
			$d=$s['id'];
			$c[$n][$d]=$s['name'];
		}
	}
	$return['cid']=$c;
	$return['endstatus2']=array(
		array('id'=>'10','title'=>'待拍'),
		array('id'=>'11','title'=>'在拍'),
		array('id'=>'1','title'=>'成交'),
		array('id'=>'2','title'=>'违约'),
		array('id'=>'3','title'=>'流拍'),
		array('id'=>'4','title'=>'撤拍'),
	);
	$return['endstatus']=array('10'=>'待拍','0'=>'在拍','1'=>'成交','2'=>'违约','3'=>'流拍','4'=>'撤拍','-1'=>'待支付');
	$return['succtype']=array('0'=>'竞拍','1'=>'成交');
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='status4'){
	pdo_update('jy_jdpm_auction',array('endstatus'=>4),array('id'=>$_RQ['id']));
	//退还上一位提交保证金用户保证金
	//获取处理当前拍前一位交保证金人员 更新用户表信息  保证金表
	$Good = pdo_get('jy_jdpm_auction',array('id'=>$_RQ['id']));
	//获取当前最高保证金
	$Good['margin'] = $userinfo['pledge'];
	$Good['insured_man'] = $Good['mid'];
	pdo_update('jy_jdpm_freezelog',array('status' => 1, 'rtime' => time()), array('id' => $_RQ['id'],'status'=>0,'uniacid'=>$_SESSION['uniacid']));
	pdo_update('jy_jdpm_member',array('wallet_pledge_freeze -=' => $Good['margin']), array('mid' => $Good['insured_man'],'uniacid'=>$_SESSION['uniacid']));
	exi('已撤拍');
}
if($_RQ['op']=='recommend'){
	pdo_update('jy_jdpm_auction',array('recommend'=>1),array('id'=>$_RQ['id'],'uniacid'=>$_SESSION['uniacid']));
	exi('推荐成功');
}
if($_RQ['op']=='unrecommend'){
	pdo_update('jy_jdpm_auction',array('recommend'=>0),array('id'=>$_RQ['id'],'uniacid'=>$_SESSION['uniacid']));
	exi('取消推荐成功');
}
if($_RQ['op']=='hide'){
	pdo_update('jy_jdpm_auction',array('hide'=>1),array('id'=>$_RQ['id'],'uniacid'=>$_SESSION['uniacid']));
	exi('已隐藏');
}
if($_RQ['op']=='unhide'){
	pdo_update('jy_jdpm_auction',array('hide'=>0),array('id'=>$_RQ['id'],'uniacid'=>$_SESSION['uniacid']));
	exi('已显示');
}
if($_RQ['op']=='ishot'){
	pdo_update('jy_jdpm_auction',array('ishot'=>1),array('id'=>$_RQ['id'],'uniacid'=>$_SESSION['uniacid']));
	exi('已设置热门');
}
if($_RQ['op']=='unhot'){
	pdo_update('jy_jdpm_auction',array('ishot'=>0),array('id'=>$_RQ['id'],'uniacid'=>$_SESSION['uniacid']));
	exi('已取消热门');
}
if($_RQ['op']=='edit'){
	$id=intval($_RQ['id']);
	$gid = intval($_RQ['id']);
	if($gid){
		//$gid=pdo_getcolumn('jy_jdpm_auction',array('pid'=>$id),'goodsid');
		$r=pdo_get('jy_jdpm_auction',array('goodsid'=>$gid,'endstatus'=>array(0,1),'uniacid'=>$_SESSION['uniacid']));
		if($r){
			exi('该商品正在拍卖或已成交，不允许再次拍卖！只有流拍和撤拍的商品才能重新发布拍卖','error','list');
		}
	}elseif($id){
		$gid=pdo_getcolumn('jy_jdpm_auction',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']),'goodsid');
		$r=pdo_get('jy_jdpm_auction',array('goodsid'=>$gid,'endstatus'=>array(0,1),'uniacid'=>$_SESSION['uniacid']));
		if($r){
			exi('该商品正在拍卖或已成交，不允许再次拍卖！只有流拍和撤拍的商品才能重新发布拍卖','error','list');
		}
	}
	$item=array();
	if($gid){
		$good=get_goodsinfo($gid);
		$item['goodsid']=$gid;
		$item['pname']=$good['title'];
		$item['price']=$good['price'];
		$item['onset']=$good['price'];
		$item['auction_no']=$good['auction_no'];
		$item['certificate_no']=$good['certificate_no'];
		
	}else{
		$item=pdo_get('jy_jdpm_auction',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
		$item['starttime']=$item['starttime']?date('Y-m-d H:m',$item['starttime']):'';
		$item['endtime']=$item['endtime']?date('Y-m-d H:m',$item['endtime']):'';
		
	}
		$item['stepsize']=$item['stepsize']?$item['stepsize']:10;
		$item['stepsize_type']=$item['stepsize_type']?:'0';
		$item['pledge']=$item['pledge']?$item['pledge']:50;
		$item['steptime']=$item['steptime']?$item['steptime']:120;
		$item['deferred']=$item['deferred']?$item['deferred']:5;
		$item['freight']=$item['freight']?$item['freight']:0;
		$return['item']=$item;
		$htmls=array(
			'type'=>'edit',
			'post'=>'post',
			'tabs'=>array(
				array('op'=>'list','title'=>'返回拍卖列表'),
				
			),
			'desc'=>'拍卖设置',
			'edit'=>array(
				array('type'=>'string','title'=>'拍卖标题','name'=>'pname'),
				array('name'=>'auction_no','title'=>'拍品编号','type'=>'copy'),
				array('name'=>'certificate_no','title'=>'证书编号','type'=>'copy'),
				array('name'=>'starttime','title'=>'开始时间','type'=>'time'),
				array('name'=>'endtime','title'=>'结束时间','type'=>'time'),
				array('name'=>'onset','title'=>'起拍价','type'=>'string','help'=>''),
				array('name'=>'price','title'=>'保留价','type'=>'string','help'=>''),
				array('name'=>'steptime','title'=>'触发延时时间段(秒)','type'=>'string','help'=>'设置最后多少秒内出价触发延时'),
				array('name'=>'deferred','title'=>'延时时间(分)','type'=>'string'),
				array('name'=>'stepsize_type','title'=>'定额加价按固定金额?','type'=>'switch'),
				array('name'=>'stepsize','title'=>'定额加价(%)','type'=>'string','help'=>'每次出价固定加价幅度,默认为起拍价的10%','show'=>array('stepsize_type'=>0)),
				array('name'=>'stepsize','title'=>'定额加价(元)','type'=>'string','help'=>'每次出价固定加价幅度,默认为起拍价的10元','show'=>array('stepsize_type'=>1)),
				array('name'=>'pledge','title'=>'保证金收取比例(%)','type'=>'string','help'=>'起拍比例百分比,另外：会受《保证金-起拍最大比例设置(倍数)》的影响：平台设置--佣金设置--《保证金-起拍最大比例设置(倍数)》'),
				
			)
		);
	
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='post'){
	$post=get_postdata();
	$id=intval($post['id']);
	$data=array(
		'onset'=>$post['onset'],
		'price'=>$post['price'],
		'pname'=>$post['pname'],
		'steptime'=>$post['steptime'],
		'deferred'=>$post['deferred'],
		'stepsize'=>$post['stepsize'],
		'stepsize_type'=>$post['stepsize_type'],
		'pledge'=>$post['pledge'],
		'goodsid'=>$post['goodsid'],
	);
	$data['starttime']=strtotime($post['starttime']);
	$data['endtime']=strtotime($post['endtime']);
	$data['endstatus']=0;
	$data['createtime']=time();
	if(empty($data['pledge'])){
		//exi('保证金比例不能为0！','error');
	}
	if(empty($data['starttime'])){
		exi('开始时间未设置！','error');
	}
	if(empty($data['endtime'])){
		exi('结束时间未设置！','error');
	}
	if(empty($data['onset']) && !$data['stepsize_type']){
		exi('起拍价为0时，必须开启《定额加价按固定金额》！','error');
	}
	if(empty($data['price'])){
		//exi('保留价未设置！','error');
	}
	if($id){
		pdo_update('jy_jdpm_auction',$data,array('id'=>$id));
		exi('编辑成功','','list');
	}else{
		$data['succtype']=0;
		$data['uniacid']=$_SESSION['uniacid'];
		pdo_insert('jy_jdpm_auction',$data);
		exi('添加成功','','list');
	}

}
if($_RQ['op']=='repm'){
	$id=intval($_RQ['id']);
	if($id){
		$item=pdo_get('jy_jdpm_auction',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
		$item['starttime']=$item['endtime']='';
		$return['item']=$item;
		$item['stepsize']=$item['stepsize']?$item['stepsize']:10;
		$item['pledge']=$item['pledge']?$item['pledge']:50;
		$item['steptime']=$item['steptime']?$item['steptime']:120;
		$item['deferred']=$item['deferred']?$item['deferred']:300;
		$item['freight']=$item['freight']?$item['freight']:0;
	}
	$htmls=array(
		'type'=>'edit',
		'post'=>'post2',
		'tabs'=>array(
			array('op'=>'list','title'=>'返回拍卖列表'),
			
		),
		'desc'=>'拍卖设置',
		'edit'=>array(
			array('type'=>'string','title'=>'拍卖标题','name'=>'pname'),
			array('name'=>'starttime','title'=>'开始时间','type'=>'time'),
			array('name'=>'endtime','title'=>'结束时间','type'=>'time'),
			array('name'=>'onset','title'=>'起拍价','type'=>'string'),
			array('name'=>'price','title'=>'保留价','type'=>'string'),
			array('name'=>'steptime','title'=>'触发延时时间段(秒)','type'=>'string','help'=>'设置最后多少秒内出价触发延时'),
			array('name'=>'deferred','title'=>'延时时间(秒)','type'=>'string'),
			array('name'=>'freight','title'=>'运费','type'=>'string'),
			array('name'=>'stepsize_type','title'=>'定额加价按固定金额?','type'=>'switch'),
			array('name'=>'stepsize','title'=>'定额加价(%)','type'=>'string','help'=>'每次出价固定加价幅度,默认为起拍价的10%','show'=>array('stepsize_type'=>0)),
			array('name'=>'stepsize','title'=>'定额加价(元)','type'=>'string','help'=>'每次出价固定加价幅度,默认为起拍价的10元','show'=>array('stepsize_type'=>1)),
			array('name'=>'pledge','title'=>'保证金收取比例(%)','type'=>'string','help'=>'起拍价的百分比,默认为起拍价的50%。另外：会受《保证金-起拍最大比例设置(倍数)》的影响：平台设置--佣金设置--《保证金-起拍最大比例设置(倍数)》'),
			
		)
		);
	
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='post2'){
	$post=get_postdata();
	$id=intval($post['id']);
	$data=array(
		'onset'=>$post['onset'],
		'price'=>$post['price'],
		'pname'=>$post['pname'],
		'steptime'=>$post['steptime'],
		'deferred'=>$post['deferred'],
		'stepsize'=>$post['stepsize'],
		'stepsize_type'=>$post['stepsize_type'],
		'pledge'=>$post['pledge'],
		'goodsid'=>$post['goodsid'],
	);
	$data['starttime']=strtotime($post['starttime']);
	$data['endtime']=strtotime($post['endtime']);
	if(empty($data['pledge'])){
		//exi('保证金比例不能为0！','error');
	}
	if(empty($data['starttime'])){
		exi('开始时间未设置！','error');
	}
	if(empty($data['endtime'])){
		exi('结束时间未设置！','error');
	}
	if(empty($data['onset']) && !$data['stepsize_type']){
		exi('起拍价为0时，必须开启《定额加价按固定金额》！','error');
	}
	if(empty($data['price'])){
		//exi('保留价未设置！','error');
	}
	if($data['price']>$data['onset']){
		exi('保留价必须小于等于起拍价！','error');
	}
	$data['createtime']=time();
	$data['endstatus']=0;
	if($id){
		pdo_update('jy_jdpm_auction',$data,array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
		exi('发布拍卖成功','','list');
	}else{
		exi('缺少拍卖id','','list');
	}

}
if($_RQ['op']=='detail'){
	if($_RQ['id']){
		$id=intval($_RQ['id']);
	}
	if($id){
		$item=pdo_get('jy_jdpm_auction',array('id'=>$id));
		$mid=get_goodsinfo($item['goodsid']);
		if($item['succtype']==1){
			$item['succtype']='成交';
		}else{
			$item['succtype']='竞拍';
		}
		if($item['pledge']==0){
			$item['pledge']=50;
		}
		$item['pledge']='按起拍价的'.$item['pledge'].'%收取';
		$sm='起拍价的'.$item['stepsize'];
		$item['stepsize']=$item['stepsize']?$sm:'起拍价的10%';
		$item['starttime']=date('Y-m-d H:m',$item['starttime']);
		$item['endtime']=date('Y-m-d H:m',$item['endtime']);
		$return['item']=$item;
	}
	$jp=pdo_getall('jy_jdpm_freezelog',array('pid'=>$id,'uniacid'=>$_SESSION['uniacid']),'','','pledge asc');
	foreach($jp as $k=>&$item){
		$item['times']='第'.($k+1).'次';
		
		$item['rtime']=$item['rtime']?date('Y-m-d H:i',$item['rtime']):'';
		$item['createtime']=$item['createtime']?date('Y-m-d H:i',$item['createtime']):'';
		$item['status']=$item['status']?'已处理':'未处理';
	}
	$return['succtype']=array('0'=>'竞拍','1'=>'成交');
	//分享金
	$fx=pdo_getall('jy_jdpm_money_log',array('pid'=>$id,'channel'=>1,'type'=>3,'mid >'=>0,'uniacid'=>$_SESSION['uniacid']),'','','id asc');
	foreach($fx as $k=>&$v1){
		$v1['times']='第'.($k+1).'次';
		$v1['role']='竞拍人';
		$v1['mid']=usercom($v1['mid']);
	}
	//成交人
	$chengjiao=pdo_get('jy_jdpm_money_log',array('pid'=>$id,'role'=>'成交人','channel'=>2,'uniacid'=>$_SESSION['uniacid']));
	if($fy){
		$chengjia['mid'] = usercom($chengjia['mid']);
		$changjiao['type']='支付拍品订单';
		$fx[]=$chengjiao;
	}
	//送拍人
	$fy=pdo_get('jy_jdpm_money_log',array('pid'=>$id,'channel'=>1,'role'=>'送拍人','uniacid'=>$_SESSION['uniacid']));
	
	if($fy){
		$fy['mid'] = usercom($fy['mid']);
		$fy['type']='送拍人收入';
		$fx[]=$fy;
	}
	//送拍商
	$fy=pdo_get('jy_jdpm_money_log',array('pid'=>$id,'role'=>'送拍商','channel'=>1,'type'=>4,'uniacid'=>$_SESSION['uniacid']));
	
	if($fy){
		$fy['mid'] = $fy['mid']?$fy['mid']:'送拍商(没设置送拍商)';
		$fy['type']='送拍商收入';
		$fx[]=$fy;
	}
	//违约送拍商收入
	$fy=pdo_get('jy_jdpm_money_log',array('pid'=>$id,'role'=>'送拍商','channel'=>1,'type'=>8,'uniacid'=>$_SESSION['uniacid']));
	
	if($fy){
		$fy['mid'] = $fy['mid']?$fy['mid']:'送拍商(没设置送拍商)';
		$fy['type']='送拍商收入';
		$fx[]=$fy;
	}
	//推广人
	$share=pdo_getall('jy_jdpm_money_log',array('pid'=>$id,'channel'=>1,'type'=>7,'uniacid'=>$_SESSION['uniacid']));
	if($share){
		foreach($share as $k=>$v2){
			$v2['mid'] = usercom($v2['mid']);
			$v2['type']='推广分享金';
			$fx[]=$v2;	
		}	
	}
	//平台佣金
	$ptyj=pdo_getall('jy_jdpm_money_log',array('pid'=>$id,'channel'=>1,'mid'=>0,'type'=>3,'uniacid'=>$_SESSION['uniacid']));
	
	if($ptyj){
		foreach($ptyj as $k=>$v3){
			$v3['mid'] = usercom($v3['mid']);
			$v3['type']='平台佣金';
			$fx[]=$v3;
		}
	}
	//违约平台佣金
	$ptyj=pdo_getall('jy_jdpm_money_log',array('pid'=>$id,'channel'=>1,'mid'=>0,'type'=>8,'uniacid'=>$_SESSION['uniacid']));
	
	if($ptyj){
		foreach($ptyj as $k=>$v8){
			$v8['mid'] = usercom($v8['mid']);
			$v8['type']='平台佣金';
			$fx[]=$v8;
		}
	}
	//服务费
	$fwf=pdo_get('jy_jdpm_money_log',array('pid'=>$id,'channel'=>1,'type'=>5,'mid'=>-1,'uniacid'=>$_SESSION['uniacid']));
	
	if($fwf){
		$fwf['mid'] = usercom($fwf['mid']);
		$fwf['type']='服务费';
		$fx[]=$fwf;
	}
	//手续费
	$sx=pdo_get('jy_jdpm_money_log',array('pid'=>$id,'channel'=>1,'type'=>5,'mid'=>-2,'uniacid'=>$_SESSION['uniacid']));
	
	if($sx){
		$sx['mid'] = usercom($sx['mid']);
		$sx['type']='手续费';
		$fx[]=$sx;
	}
	$return['fx']=$fx;
	$return['jp']=$jp;
	
	exi($return);
}
if($_RQ['op']=='del'){
	$id=intval($_RQ['id']);
	if($id){
		pdo_delete('jy_jdpm_auction',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));	
		exi('删除成功');
	}
	$del=trim($_RQ['del'],';');
	if($del){
		$del=explode(';',$del);
		foreach($del as $id){
			$id=intval($id);
			if($id){
				pdo_delete('jy_jdpm_auction',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
			}
		}
	}
	exi('删除成功！');
}